package edu.cmu.cs.webapp.ioms.ui.providers.product;

import java.text.DateFormat;

import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;

import edu.cmu.cs.webapp.ioms.models.FormularRecord;
import edu.cmu.cs.webapp.ioms.models.OrderStatus;
import edu.cmu.cs.webapp.ioms.models.PurchaseOrder;
import edu.cmu.cs.webapp.ioms.utils.IOMSImageHelper;
import edu.cmu.cs.webapp.ioms.utils.IOMSImages;

public class IngreLstTblViewerLableProvider extends ColumnLabelProvider
		implements ITableLabelProvider {

	public static final int INGREDIENT_ID = 0;
	public static final int INGREDIENT_NAME = 1;

	public static final int INGREDIENT_QUANTITY = 2;
	public static final int INGREDIENT_PRICE = 3;
	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		if (element != null) {
			if (columnIndex == INGREDIENT_ID) {
				return IOMSImageHelper.getInstance().getImage(
						IOMSImages.IMG_FORMULAR);
			}
		}
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang
	 * .Object, int)
	 */
	@Override
	public String getColumnText(Object element, int columnIndex) {
		if (element instanceof FormularRecord) {
			FormularRecord formulaRecord = (FormularRecord) element;
			switch (columnIndex) {
			case INGREDIENT_ID:
				// id
				return "" + String.valueOf(formulaRecord.getForm_id());
			case INGREDIENT_NAME:
				// order status
				return formulaRecord.getIngredient().getName();
			case INGREDIENT_PRICE:
				// order date
				return String.valueOf(formulaRecord.getIngredient().getUnit_cost());
			case INGREDIENT_QUANTITY:
				// order date
				return String.valueOf(formulaRecord.getIng_std_quantity());
				
			/*case INGREDIENT_DESCRIPTION:
				// order date
				return formulaRecord.getIngredient().getRemark();*/
			default:
				return "";
			}
		}

		return "";

	}
}
